package com.letian.record.service.impl;

import java.util.List;
import com.letian.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.letian.record.mapper.RecordGenealogyMapper;
import com.letian.record.domain.RecordGenealogy;
import com.letian.record.service.IRecordGenealogyService;

/**
 * 族谱Service业务层处理
 * 
 * @author bmz
 * @date 2025-07-20
 */
@Service
public class RecordGenealogyServiceImpl implements IRecordGenealogyService 
{
    @Autowired
    private RecordGenealogyMapper recordGenealogyMapper;

    /**
     * 查询族谱
     * 
     * @param genealogyId 族谱主键
     * @return 族谱
     */
    @Override
    public RecordGenealogy selectRecordGenealogyByGenealogyId(Long genealogyId)
    {
        return recordGenealogyMapper.selectRecordGenealogyByGenealogyId(genealogyId);
    }

    /**
     * 查询族谱列表
     * 
     * @param recordGenealogy 族谱
     * @return 族谱
     */
    @Override
    public List<RecordGenealogy> selectRecordGenealogyList(RecordGenealogy recordGenealogy)
    {
        return recordGenealogyMapper.selectRecordGenealogyList(recordGenealogy);
    }

    /**
     * 新增族谱
     * 
     * @param recordGenealogy 族谱
     * @return 结果
     */
    @Override
    public int insertRecordGenealogy(RecordGenealogy recordGenealogy)
    {
        recordGenealogy.setCreateTime(DateUtils.getNowDate());
        recordGenealogy.setUpdateTime(DateUtils.getNowDate());
        return recordGenealogyMapper.insertRecordGenealogy(recordGenealogy);
    }

    /**
     * 修改族谱
     * 
     * @param recordGenealogy 族谱
     * @return 结果
     */
    @Override
    public int updateRecordGenealogy(RecordGenealogy recordGenealogy)
    {
        recordGenealogy.setUpdateTime(DateUtils.getNowDate());
        return recordGenealogyMapper.updateRecordGenealogy(recordGenealogy);
    }

    /**
     * 批量删除族谱
     * 
     * @param genealogyIds 需要删除的族谱主键
     * @return 结果
     */
    @Override
    public int deleteRecordGenealogyByGenealogyIds(Long[] genealogyIds)
    {
        return recordGenealogyMapper.deleteRecordGenealogyByGenealogyIds(genealogyIds);
    }

    /**
     * 删除族谱信息
     * 
     * @param genealogyId 族谱主键
     * @return 结果
     */
    @Override
    public int deleteRecordGenealogyByGenealogyId(Long genealogyId)
    {
        return recordGenealogyMapper.deleteRecordGenealogyByGenealogyId(genealogyId);
    }
}
